package com.jnc.core.config.shiro.session;

import com.jnc.core.config.redis.RedisStore;
import org.apache.shiro.cache.Cache;
import org.apache.shiro.cache.CacheException;
import org.apache.shiro.cache.CacheManager;

/**
 * @Author: jjn
 * @Date: 2018/11/1
 * @Desc: Redis Shiro自定义缓存管理器
 */
public class RedisShiroCacheManager implements CacheManager {

    private RedisStore redisStore;

    public RedisShiroCacheManager(RedisStore redisStore) {
        this.redisStore = redisStore;
    }

    @Override
    public <K, V> Cache<K, V> getCache(String s) throws CacheException {
        return new RedisShiroCache<K, V>(redisStore);
    }
}
